#pragma once
#ifndef __MY_LOG__
#define __MY_LOG__

#define DBGLOG 0
#define INFLOG 1
#define ERRLOG 2
#define DEFAULTLOG DBGLOG

#define LOG(level, log_level, format, ...)             \
    {                                       \
        if (level >= DEFAULTLOG)             \
        {                                   \
            time_t t = time(NULL);          \
            struct tm *ltm = localtime(&t); \
            char tmp[32] = {0};             \
            printf("[%s %s:%d] [%s]\n\t" format "\n", tmp, __FILE__, __LINE__, log_level, ##__VA_ARGS__);\
        }                                   \
}

#define DLOG(format, ...) LOG(DBGLOG, "Debug", format, ##__VA_ARGS__)
#define ILOG(format, ...) LOG(INFLOG, "Info", format, ##__VA_ARGS__)
#define ELOG(format, ...) LOG(ERRLOG, "Error", format, ##__VA_ARGS__)

#endif

            // fprintf(stdout, "[%s %s:%d] [%s]\n\t" format "\n", tmp, __FILE__, __LINE__, log_level, ##__VA_ARGS__);
